package com.itfenghuang.controller;

import com.itfenghuang.bean.User;
import com.itfenghuang.service.UserService;
import com.itfenghuang.service.imp.UserServiceImp;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class UpdateUserServlet extends HttpServlet {
    private UserService service=new UserServiceImp();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        //获取请求参数
        String password = req.getParameter("password");
        String password1 = req.getParameter("password1");
        User user = new User();
        user.setId(1);
        user.setPassword(password1);
        String s = service.updatePassword(user);
        //判断密码是否一致
        resp.getWriter().write("修改成功");

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            doGet(req, resp);
    }
}
